package org.example.Mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.example.domain.ExcelRecord;

@Mapper
public interface ExcelRecordMapper {

    @Insert("INSERT INTO excelRecord (orderNumber,name,account,p_st,p_st_szpg,p_st_xkqz,p_st_tyqp,p_st_myrx,p_st_ldqj" +
            ",p_st_cxcy) VALUES (#{orderNumber},#{name},#{account},#{p_st},#{p_st_szpg},#{p_st_xkqz},#{p_st_tyqp}" +
            ",#{p_st_myrx},#{p_st_ldqj},#{p_st_cxcy});")
    void addOneExcelRecord(@Param("orderNumber") Integer orderNumber,@Param("name") String name,
                           @Param("account") String account, @Param("p_st") Integer p_st,
                           @Param("p_st_szpg") Integer p_st_szpg,@Param("p_st_xkqz") Integer p_st_xkqz,
                           @Param("p_st_tyqp") Integer p_st_tyqp,@Param("p_st_myrx") Integer p_st_myrx,
                           @Param("p_st_ldqj") Integer p_st_ldqj,@Param("p_st_cxcy") Integer p_st_cxcy);

    @Select("SELECT * FROM excelRecord ORDER BY id DESC LIMIT 1;")
    ExcelRecord getLastExcelRecordIndex();

    @Select("SELECT * FROM excelRecord WHERE orderNumber =#{orderNumber};")
    ExcelRecord[] getExcelRecordsByOrderNumber(Integer orderNumber);

}